capture log close
log using "${path_log}/07_analysis_shiftshare.log", replace

use "${path_data}\bopf_shiftshare", clear 
 
*** Appendix Table C.1 
eststo: qui reghdfe inflexpoint price_shock, absorb(BBk_Sample_Key wave) cluster(BBk_Sample_Key)
add_info inflexpoint, num(1) id(BBk_Sample_Key)
eststo: qui reghdfe inflexpoint price_shock, absorb(BBk_Sample_Key sector_wave) cluster(BBk_Sample_Key) 
add_info inflexpoint, num(2) id(BBk_Sample_Key)
eststo: qui reghdfe pricefuture price_shock, absorb(BBk_Sample_Key wave) cluster(BBk_Sample_Key)
add_info pricefuture, num(3) id(BBk_Sample_Key)
eststo: qui reghdfe pricefuture price_shock, absorb(BBk_Sample_Key sector_wave) cluster(BBk_Sample_Key) 
add_info pricefuture, num(4) id(BBk_Sample_Key)

esttab using "${path_export_tables}\appendix_table_c1.tex", keep(price_shock) star(* 0.1 ** 0.05 *** 0.01) se(3) b(3) posthead("") postfoot("firm FE & {yes} & {yes} & {yes} & {yes} \\" "month FE & {yes} & & {yes} & \\"   "sector x month FE & & {yes}& & {yes} \\" "\midrule" "mean & ${mean1} &${mean2} & ${mean3} & ${mean4} \\" "N & ${N1} &${N2} & ${N3} & ${N4}\\" "\# cluster & ${cluster1} &${cluster2} & ${cluster3} & ${cluster4} \\" "\bottomrule \bottomrule") nomtitles nonumbers fragment noobs varlabel(price_shock "$\text{energy cost share} \cdot \sum_{e \in E} \text{share}_{e} \cdot \Delta p_{et}$") varwidth(90) substitute("\_" "_") replace
	
est clear

*** Appendix Table C.2 
eststo: qui reghdfe inflexpoint price_shock_ext, absorb(BBk_Sample_Key wave) cluster(BBk_Sample_Key)
add_info inflexpoint, num(1) id(BBk_Sample_Key)
eststo: qui reghdfe inflexpoint price_shock_ext, absorb(BBk_Sample_Key sector_wave) cluster(BBk_Sample_Key) 
add_info inflexpoint, num(2) id(BBk_Sample_Key)
eststo: qui reghdfe pricefuture price_shock_ext, absorb(BBk_Sample_Key wave) cluster(BBk_Sample_Key)
add_info pricefuture, num(3) id(BBk_Sample_Key)
eststo: qui reghdfe pricefuture price_shock_ext, absorb(BBk_Sample_Key sector_wave) cluster(BBk_Sample_Key) 
add_info inflexpoint, num(4) id(BBk_Sample_Key)

esttab using "${path_export_tables}\appendix_table_c2.tex", keep(price_shock_ext) star(* 0.1 ** 0.05 *** 0.01) se(3) b(3) posthead("") postfoot("firm FE & {yes} & {yes} & {yes} & {yes} \\" "month FE & {yes} & & {yes} & \\"   "sector x month FE & & {yes}& & {yes} \\" "\midrule" "mean & ${mean1} &${mean2} & ${mean3} & ${mean4} \\" "N & ${N1} &${N2} & ${N3} & ${N4}\\" "\# cluster & ${cluster1} &${cluster2} & ${cluster3} & ${cluster4} \\" "\bottomrule \bottomrule") nomtitles nonumbers fragment noobs varlabel(price_shock_ext "$\text{energy cost share} \cdot \sum_{e \in E} \text{share}_{e} \cdot \Delta p_{et}$") varwidth(90) substitute("\_" "_") replace

est clear

log close